Skip to content

refactor(presence): Pass arguments as an object to StateFactory.latest/latestMap #24414

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
Apr 22, 2025

Conversation

tylerbutler
Copy link
Member

@tylerbutler tylerbutler commented Apr 21, 2025

This change updates the signatures of the Latest/LatestMap functions to accept an object as the only argument. The arguments have been named to align with other parts of the API (e.g. local).

@Copilot Copilot AI review requested due to automatic review settings April 21, 2025 22:35
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the Latest and LatestMap functions to accept a single object argument instead of multiple parameters, consolidating common options under the PresenceStateOptions interface. Key changes include:

  • Updating test cases to pass objects with an "initialValue" property.
  • Modifying the signature and internal implementation of Latest and LatestMap functions.
  • Re-exporting the new interfaces in the package index and API report.

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/framework/presence/src/test/presenceStates.spec.ts Updated test to use the new object argument for Latest.
packages/framework/presence/src/test/latestValueManager.spec.ts Updated tests to reflect the new Latest signature.
packages/framework/presence/src/test/latestMapValueManager.spec.ts Updated tests to use the new object argument for LatestMap.
packages/framework/presence/src/test/eventing.spec.ts Updated tests in eventing to pass new argument objects.
packages/framework/presence/src/test/batching.spec.ts Adjusted batching tests to use the new signatures.
packages/framework/presence/src/latestValueTypes.ts Added the PresenceStateOptions interface.
packages/framework/presence/src/latestValueManager.ts Modified Latest signature to accept a LatestProps object.
packages/framework/presence/src/latestMapValueManager.ts Modified LatestMap signature to accept a LatestMapProps object.
packages/framework/presence/src/index.ts Re-exported the new types.
packages/framework/presence/api-report/presence.alpha.api.md Updated API report with the new signatures and types.
examples/apps/presence-tracker/src/MouseTracker.ts Updated usage of Latest with the object argument.
examples/apps/presence-tracker/src/FocusTracker.ts Updated usage of Latest with the new object argument.

@github-actions github-actions bot added area: examples Changes that focus on our examples area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct public api change Changes to a public API base: main PRs targeted against main branch labels Apr 21, 2025
@tylerbutler tylerbutler changed the title refactor(presence): Pass arguments as an object to Latest/LatestMap refactor(presence): Pass arguments as an object to StateFactory.latest/latestMap Apr 22, 2025
@tylerbutler tylerbutler requested a review from a team as a code owner April 22, 2025 00:57
Copy link
Contributor

@alexvy86 alexvy86 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs look good, just a nit below.

@jason-ha
Copy link
Contributor

I was going to resolve the conflicts to help. I staged it locally and was going to use github UI to make the changes, but there are test changes needed too. So, I have them in a branch. Published to https://github.com/microsoft/FluidFramework/tree/presence/obj-args (merge to your branch with fast forward)

@tylerbutler tylerbutler enabled auto-merge (squash) April 22, 2025 20:14
Copy link
Contributor

🔗 No broken links found! ✅

Your attention to detail is admirable.

linkcheck output


> fluid-framework-docs-site@0.0.0 ci:check-links /home/runner/work/FluidFramework/FluidFramework/docs
> start-server-and-test "npm run serve -- --no-open" 3000 check-links

1: starting server using command "npm run serve -- --no-open"
and when url "[ 'http://127.0.0.1:3000' ]" is responding with HTTP status code 200
running tests using command "npm run check-links"


> fluid-framework-docs-site@0.0.0 serve
> docusaurus serve --no-open

[SUCCESS] Serving "build" directory at: http://localhost:3000/

> fluid-framework-docs-site@0.0.0 check-links
> linkcheck http://localhost:3000 --skip-file skipped-urls.txt

Crawling...

Stats:
  163679 links
    1315 destination URLs
    1547 URLs ignored
       0 warnings
       0 errors


@tylerbutler tylerbutler merged commit 446d418 into microsoft:main Apr 22, 2025
38 checks passed
@tylerbutler tylerbutler deleted the presence-obj-args branch April 22, 2025 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: examples Changes that focus on our examples area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct base: main PRs targeted against main branch changeset-present public api change Changes to a public API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants